import request from '@/api/myRequest'
//获取商品列表
function productsByPageApi(start, limit, data) {
  return request({
    url: `/lejuAdmin/product/productsByPage/${start}/${limit}`,
    method: 'POST',
    data
  })
}
//删除商品
function productdelApi(productId) {
  return request({
    url: `/lejuAdmin/product/del/${productId}`,
    method: 'DELETE'
  })
}
//是否最新
function switchNewStatusApi(data) {
  return request({
    url: `/lejuAdmin/product/switchNewStatus`,
    method: 'POST',
    data
  })
}
//是否最新
function switchRecommandStatus(data) {
  return request({
    url: `/lejuAdmin/product/switchRecommandStatus`,
    method: 'POST',
    data
  })
}
//是否发布
function switchPublishStatus(data) {
  return request({
    url: `/lejuAdmin/product/switchPublishStatus`,
    method: 'POST',
    data
  })
}
//是否审核
function switchVerifyStatus(data) {
  return request({
    url: `/lejuAdmin/product/switchVerifyStatus`,
    method: 'POST',
    data
  })
}
//品牌列表
function findAllBrandApi() {
  return request({
    url: '/lejuAdmin/brand/findAllBrand',
    method: 'GET'
  })
}
//商品分类
function getAllCategoryApi(data) {
  return request({
    url: '/lejuAdmin/category/getAllCategory',
    method: 'GET',
    params: data
  })
}
//品牌管理列表
function findBrandByPageApi(start, limit, data) {
  return request({
    url: `/lejuAdmin/brand/findBrandByPage/${start}/${limit}`,
    method: 'GET',
    params: data
  })
}
//是否展示
function switchShowStatusApi(data) {
  return request({
    url: `/lejuAdmin/brand/switchShowStatus`,
    method: 'POST',
    data
  })
}
//删除品牌
function delBrandApi(id) {
  return request({
    url: `/lejuAdmin/brand/delBrand/${id}`,
    method: 'DELETE'
  })
}
//添加品牌
function addBrandApi(data) {
  return request({
    url: `/lejuAdmin/brand/addBrand`,
    method: 'POST',
    data
  })
}
//更新品牌
function updateBrandApi(data) {
  return request({
    url: `/lejuAdmin/brand/updateBrand`,
    method: 'POST',
    data
  })
}
//添加商品信息
function addProductAndSkusApi(data) {
  return request({
    url: `/lejuAdmin/product/addProductAndSkus`,
    method: 'POST',
    data
  })
}
//根据商品id查询库存 SKU
function getSkusByProductIdApi(productId, data) {
  return request({
    url: `/lejuAdmin/sku/getSkusByProductId/${productId}`,
    method: 'GET',
    params: data
  })
}
//删除sku
function delSkuApi(skuId) {
  return request({
    url: `/lejuAdmin/sku/delSku/${skuId}`,
    method: 'DELETE'
  })
}
//修改SKU
function updateSkuInfoApi(data) {
  return request({
    url: `/lejuAdmin/sku/updateSkuInfo`,
    method: 'GET',
    params: data
  })
}
export default {
  updateSkuInfoApi,
  delSkuApi,
  getSkusByProductIdApi,
  addProductAndSkusApi,
  updateBrandApi,
  addBrandApi,
  delBrandApi,
  switchShowStatusApi,
  getAllCategoryApi,
  productsByPageApi,
  productdelApi,
  switchNewStatusApi,
  switchRecommandStatus,
  switchPublishStatus,
  switchVerifyStatus,
  findAllBrandApi,
  findBrandByPageApi
  // fetchListApi,
}
